using System;
using Wilco.SyntaxHighlighting.Engine.Node;
using Wilco.SyntaxHighlighting.Engine.Node.Occurrence;

namespace Wilco.SyntaxHighlighting.Engine.Node.Occurrence
{
    /// <summary>
    /// Represents the method that will handle the <see cref="INode.OccurrenceAdded"/> and 
    /// <see cref="INode.OccurrenceRemoved"/> events of the 
    /// <see cref="INode"/> implementation classes.
    /// </summary>
    public delegate void OccurrenceEventHandler(object sender, OccurrenceEventArgs e);

    /// <summary>
    /// Provides data for the <see cref="INode.OccurrenceAdded"/> and
    /// <see cref="INode.OccurrenceRemoved"/> events.
    /// </summary>
    [Serializable]
    public class OccurrenceEventArgs : EventArgs
    {
        private readonly Occurrence occurrence;

        /// <summary>
        /// Gets the occurrence used by this event.
        /// </summary>
        public Occurrence Occurrence
        {
            get
            {
                return occurrence;
            }
        }

        /// <summary>
        /// Initializes a new instance of a <see cref="OccurrenceEventArgs"/> class.
        /// </summary>
        /// <param name="occurrence">The occurrence to store in this event.</param>
        public OccurrenceEventArgs(Occurrence occurrence)
        {
            this.occurrence = occurrence;
        }
    }
}